diff options
author | Valentin Popov <valentin@popov.link> | 2025-06-14 14:25:17 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2025-06-14 14:25:17 +0300 |
commit | 17f9a467d7c0f427ae9d1cd579988a26615311c7 (patch) | |
tree | dfa72e6ca88f8ff1806477853d292dcef2b1255c /src/pages/blog/[...slug].astro | |
parent | 3df02c5304b8faee540694b15041ad2ee43bc1b2 (diff) | |
download | popov.link-17f9a467d7c0f427ae9d1cd579988a26615311c7.tar.xz popov.link-17f9a467d7c0f427ae9d1cd579988a26615311c7.zip |
refactor: update blog post date handling and schema
- Replaced `pubDate` with `datePublished` in blog post components for consistency.
- Updated sorting logic in blog sections to use `datePublished`.
- Enhanced blog post schema to include `dateModified` for better structured data representation.
- Adjusted various blog markdown files to reflect the new date fields.
Diffstat (limited to 'src/pages/blog/[...slug].astro')
-rw-r--r-- | src/pages/blog/[...slug].astro | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 3cfdf31..deb98ac 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -27,15 +27,18 @@ const description = post.data.description; const author = post.data.author; const lang = post.data.lang; -const formattedData = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY"); -const data = post.data.pubDate.toISOString(); +const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY"); +const datePublished = post.data.datePublished.toISOString(); +const dateModified = post.data.dateModified?.toISOString(); +const slug = post.slug; const schema = blogPostSchema({ siteUrl: new URL("/", Astro.site).toString(), title, description, - slug: post.slug, - datePublished: data, + slug, + datePublished, + dateModified, author, lang, }); @@ -57,7 +60,7 @@ const schema = blogPostSchema({ <p> <small> Posted - <time datetime={data} lang="en">{formattedData}</time> + <time datetime={datePublished} lang="en">{formattedDate}</time> by {author} <span> • </span> <span>{remarkPluginFrontmatter.minutesRead}</span> |